import React, { PureComponent } from 'react'
import { createPortal } from 'react-dom'
import './style.css'

export class Modal extends PureComponent {
  render() {
    return createPortal(
      <>
        <div className="modal-mask"></div>
        <div className="modal-wrapper">
          { this.props.children }
        </div>
      </>, document.querySelector('#newRoot')
    )
  }
}

export default Modal